package cn.jyszn.wxb.dao;

import java.util.List;

import org.apache.ibatis.annotations.Param;

import cn.jyszn.wxb.model.UserInfo;
import org.springframework.stereotype.Repository;

@Repository("userInfoMapper")
public interface UserInfoMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(UserInfo record);

    int insertSelective(UserInfo record);

    UserInfo selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(UserInfo record);

    int updateByPrimaryKey(UserInfo record);
    
    
    int updateAllLeftNum(int num);
    
    int updateAllRightNum(int num);
    
    List<UserInfo> selectByBelongCode(@Param("belongCode") String belongCode,
                                      @Param("start") int start,
                                      @Param("rows") int rows,
                                      @Param("startTimeStamp") long startTimeStamp,
                                      @Param("endTimeStamp") long endTimeStamp);
    
    int totalByBelongCode(@Param("belongCode") String belongCode,
                          @Param("startTimeStamp") long startTimeStamp,
                          @Param("endTimeStamp") long endTimeStamp);
    
    List<UserInfo> selectChildNodeById(@Param("id") int id,
                                       @Param("level") int level,
                                       @Param("depth") int depth,
                                       @Param("start") int start,
                                       @Param("rows") int rows,
                                       @Param("startTimeStamp") long startTimeStamp,
                                       @Param("endTimeStamp") long endTimeStamp);
    
    int totalChildNodeById(@Param("id") int id,
                           @Param("level") int level,
                           @Param("depth") int depth,
                           @Param("startTimeStamp") long startTimeStamp,
                           @Param("endTimeStamp") long endTimeStamp);


    UserInfo selectForLogin(@Param("phone") Long phone, @Param("password") String password);
}